package likou.jindian;

/**
 * @author: 唐小尊
 * @email: 1171702529@qq.com
 * @cate: 2021/05/18 09:25
 */
public class _16_17 {
    public int maxSubArray(int[] nums) {
        int[] numa = new int[nums.length];
        numa[0]=nums[0];
        int res = Integer.MIN_VALUE;
        for (int i=1;i<nums.length;i++){
            numa[i] = Math.max(i,i+numa[i-1]);
            res = Math.max(numa[i],res);
        }
        return res;
    }
}
